package com.jlmv.poseidon.framework.service;

import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jlmv.poseidon.entidades.TipoDocumento;
import com.jlmv.poseidon.framework.dao.DaoImp;

@Service
public class TipoDocumentoService {

	@Autowired
	private DaoImp<TipoDocumento> daoImp;

	@Transactional
	public void create(TipoDocumento documento) throws SQLException {
		daoImp.create(documento);
	}

	@Transactional
	public void create(List<TipoDocumento> list)
			throws DataIntegrityViolationException {
		for (TipoDocumento iterable_element : list) {
			iterable_element.setEstado(null);
			daoImp.create(iterable_element);
		}

	}

}
